<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    function IsPC() {
        var userAgentInfo = navigator.userAgent;
        console.log(userAgentInfo,'useragent');
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
        // console.log(Agents);
        var flag = true;
        for (var v = 0; v < Agents.length; v++) {
            if (userAgentInfo.indexOf(Agents[v]) > 0) { 
                flag = false;
                console.log(24);
                break; }
        }
        console.log(flag,'flag');
        return flag;
    }
    IsPC()
    if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
        //alert(navigator.userAgent);  
        // window.location.href = "iPhone.html";
        console.log(0);
    } else if (/(Android)/i.test(navigator.userAgent)) {
        //alert(navigator.userAgent); 
        // window.location.href = "Android.html";
        console.log(1);
    } else {
        // window.location.href = "pc.html";
        console.log(2);
    };

</script>

</html>